package com.itxuchao.demo1;

import java.util.Random;
import java.util.Scanner;

public class Demo6 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入第一个数组长度:");
        int n = sc.nextInt();
        System.out.println("请输入第二个数组长度:");
        int m = sc.nextInt();
            int[] arr1 = new int[n];
            int[] arr2 = new int[m];
            for (int i = 0; i < arr1.length; i++) {
                System.out.println("请输入数组一的第"+ (i + 1) +"个元素:");
                arr1[i] = sc.nextInt();
            }
            for (int i = 0; i < arr2.length; i++) {
                System.out.println("请输入数组二的第"+ (i + 1) +"个元素:");
                arr2[i] = sc.nextInt();
            }
            Arrder(arr1, arr2);
    }
    public static void Arrder(int[] arr1,int[] arr2) {
        if (arr1.length==arr2.length){
            for (int i = 0; i <arr1.length ; i++) {
                if (arr1[i]!=arr2[i]){
                    System.out.println("第"+(i+1)+"个元素不同");
                    return;
                }
            }
            System.out.println("数组相同!");
            return;
        }else{
            System.out.println("数组长度不同");
        }

    }//判断接收的两个数组是否相同
}
